/**
 * 
 */
package com.zc.BankCreditManagement.ServiceImpl;

import java.util.ArrayList;

import com.zc.BankCreditManagement.DAO.CustomerCreditLevelHistoryDAO;
import com.zc.BankCreditManagement.JavaBean.CustomerCreditLevelHistory;
import com.zc.BankCreditManagement.Service.CustomerCreditLevelHisService;

/**
 * @author ZhangCheng
 * @time 2019年9月18日 CustomerCreditLevelHis业务实现类
 */
public class CustomerCreditLevelHisServiceImpl implements CustomerCreditLevelHisService {
	CustomerCreditLevelHistoryDAO cCLHisDAO = new CustomerCreditLevelHistoryDAO();

	/**
	 * 直接根据cusId查询所有历史信息
	 */
	public ArrayList<CustomerCreditLevelHistory> getcCLHisByCusId(String cusId,boolean excludeDelete,boolean isASC) {
		return cCLHisDAO.getCusCreditLevelHissByCusId(cusId, excludeDelete,isASC);
	}

	/**
	 * 直接根据cusId和开始月份查询所有历史信息
	 */
	public ArrayList<CustomerCreditLevelHistory> getcCLHisByBeginMonth(String cusId, int mon,boolean excludeDelete,boolean isASC) {
		ArrayList<CustomerCreditLevelHistory> cCLHis = new ArrayList<CustomerCreditLevelHistory>();
		for (CustomerCreditLevelHistory c : getcCLHisByCusId(cusId,excludeDelete,isASC)) {
			if (mon == Integer.parseInt(c.getThisLevelBeginDate().split("-")[1])) {
				cCLHis.add(c);
			}
		}
		return cCLHis;
	}

	/**
	 * 直接根据cusId和开始年份查询所有历史信息
	 */
	public ArrayList<CustomerCreditLevelHistory> getcCLHisByBeginYear(String cusId, int year,boolean excludeDelete,boolean isASC) {
		ArrayList<CustomerCreditLevelHistory> cCLHis = new ArrayList<CustomerCreditLevelHistory>();
		for (CustomerCreditLevelHistory c : getcCLHisByCusId(cusId,excludeDelete, isASC)) {
			if (year == Integer.parseInt(c.getThisLevelBeginDate().split("-")[0])) {
				cCLHis.add(c);
			}
		}
		return cCLHis;
	}

	/**
	 * 直接根据cusId和信用等级所有历史信息
	 */
	public ArrayList<CustomerCreditLevelHistory> getcCLHisByLevel(String cusId, int level,boolean excludeDelete,boolean isASC) {
		ArrayList<CustomerCreditLevelHistory> cCLHis = new ArrayList<CustomerCreditLevelHistory>();
		for (CustomerCreditLevelHistory c : getcCLHisByCusId(cusId,excludeDelete, isASC)) {
			if (level == c.getCreditLevel()) {
				cCLHis.add(c);
			}
		}
		return cCLHis;
	}
	

}
